import Vue from 'vue'
import VueRouter from "vue-router";
Vue.use(VueRouter)

// 导入1级
import layout from '@/views/layout'
import detail from '@/views/article-detail'
// 导入2级
import article from '@/views/article'
import collect from '@/views/collect'
import like from '@/views/like'
import user from '@/views/user'


const router = new VueRouter({
  routes: [
    { path: '/', redirect: '/article' },
    {
      name: 'layout',
      path: '/layout',
      component: layout,
      children: [
        { name: 'article', path: '/article', component: article },
        { name: 'collect', path: '/collect', component: collect },
        { name: 'like', path: '/like', component: like },
        { name: 'user', path: '/user/:id/:name', component: user },
      ]
    },
    {
      name: 'detail',
      path: '/detail/:id',
      component: detail
    },
  ]
})

export default router